package com.candy.mmcock;

/**
 * @author donglin
 * @Title:
 * @类名: Mother
 * @date 2020/6/2
 */
public class Mother extends Thread{

    private Kitchen kitchen;

    public Mother(Kitchen kitchen) {
        super("妈妈");
        //设置为守护线程，当孩子线程吃饱结束后，该线程自动结束
        this.setDaemon(true);
        this.kitchen = kitchen;
    }
    //方法：做饭
    public void cock() throws InterruptedException {
        this.kitchen.do_cock();
    }

    @Override
    public void run() {
        //孩子吃完，进行做饭操作
       while (true){
           try {
               this.cock();
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
       }
    }
}
